<?php
/*  
  Copyright (c) 2010-02 SongCMS 
  SongCMS All Rights Reserved. 
  Support:www.SongCMS.com
  QQ:544255858   19951025
  Author:Song  Version:3.17
  Date:2010-08-12 09:28:32
*/

include_once('Admin.php');
if ($_GET['Action'] == 'Del') {
	if (!is_numeric($_GET['ID'])) {MsgBox (1,'ID参数出现非数字错误！','-1');}
	//为保证系统中至少有一位超级管理员，禁止对当前已登录的超级管进员进行删除操作
	if ($_SESSION['ID'] == $_GET['ID']){AdminLog(3,1,'尝试删除管理员(ID号：' . $_GET['ID'] . ')失败，原因：要删除的管理员为已登录状态！'); MsgBox (1,'操作失败，当前用户已经登录，无法删除！','-1');}
	if($db->ExecuteSQL("DELETE FROM `" . $dbprefix . "admin` WHERE `ID` = " . $_GET['ID'])){
		AdminLog(3,1,'删除管理员(ID号：' . $_GET['ID'] . ')，结果：操作成功！'); 
		MsgBox (0,'','0');
	} else {
		AdminLog(3,1,'删除管理员(ID号：' . $_GET['ID'] . ')，结果：操作失败！'); 
		MsgBox (1,'操作失败！','-1');
	}
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link href="./images/adminstyle.css" rel="stylesheet" type="text/css" />
<link rel="Shortcut Icon" href="../favicon.ico">
<link rel="Bookmark" href="../favicon.ico">
<script src="../js/csshovernotie6.js" type="text/javascript"></script>
</head>
<body>
<br />
<table width="98%" border="0" align="center" cellpadding="0" cellspacing="0">
	<tr class="Notodd"><td>&nbsp;</td>
	<td align="right">
		<input type="button" value="添加管理员" onClick="javascript:location.href='AdminAdd.php?Lang=<?php echo $Lang?>'">
	</td>
	</tr>
</table>
<table width="98%" border="0" align="center" cellpadding="4" cellspacing="1" bgcolor="#CCCCCC">
  <tr class="odd">
    <td colspan="6" align="center" class="Main_Title">管理员管理</td>
  </tr>
  <tr class="odd">
    <td height="20" align="center"><strong>用户名</strong></td>
    <td align="center"><strong>最后登录IP</strong></td>
    <td align="center"><strong>最后登录时间</strong></td>
    <td align="center"><strong>登录次数</strong></td>
    <td align="center"><strong>权限级别</strong></td>
    <td align="center"><strong>管理选项</strong></td>
  </tr>
<?php
$Rs = $db->SelectSQL("SELECT `ID`,`UserName`,`LastLoginIP`,`LastLoginTime`,`Logins`,`Levels` FROM `" . $dbprefix . "admin` ORDER BY `ID` ASC");
for ($i=0;$i<count($Rs);$i++){
	$Rs[$i][5] == 1 ? $Levels = '<font color="#FF0000">超级管理员</font>' : $Levels = '<font color="#0000FF">普通管理员(受限)</font>';
	echo '<tr class="odd">
	<td height="20" align="center">' . $Rs[$i][1] . '</td>
	<td align="center"><a target="_blank" href="../inc/gettopost.php?Action=IP&IP=' . $Rs[$i][2] . '">' . $Rs[$i][2] . '</a></td>
	<td align="center">' . $Rs[$i][3] . '</td>
	<td align="center"><font color="#0000FF">' . $Rs[$i][4] . '</font></td>
	<td align="center">' . $Levels . '</td>
	<td align="center"><a href="AdminUpDate.php?ID=' . $Rs[$i][0] . '">修改</a> | <a onClick="return confirm(\'确定删除该管理员吗？\');" href="?Action=Del&ID=' . $Rs[$i][0] . '">删除</a></td>
	</tr>';	
}
?>
</table>
</body>
</html>